<template>
  <div style="padding: 16px">
    <el-table
      v-loading="loading"
      fit
      highlight-current-row
      style="width: 100%"
      :data="tableData"
    >
      <el-table-column prop="student.stuName" label="学生姓名">
      </el-table-column>
      <el-table-column prop="score" label="考试分数"> </el-table-column>
      <el-table-column prop="createTime" label="批改时间"> </el-table-column>
    </el-table>

    <pagination
      v-show="totalCount > 0"
      :total="totalCount"
      :page.sync="queryParam.pageIndex"
      :limit.sync="queryParam.pageSize"
      @pagination="search"
    />
  </div>
</template>

<script>
import Pagination from "@/components/Pagination";

import { list as scoreListApi } from "@/api/score";

export default {
  components: { Pagination },
  data() {
    return {
      loading: true,
      examId: 0,
      tableData: [],
      queryParam: {
        pageIndex: 1,
        pageSize: 10,
      },
      totalCount: 0,
    };
  },
  computed: {},
  watch: {},
  methods: {},
  async created() {
    this.examId = this.$route.query.id || 0;
    await scoreListApi({
      examId: this.examId,
    }).then(({ data }) => {
      this.loading = false;
      this.queryParam.pageIndex = data.pageIndex;
      this.queryParam.pageSize = data.pageSize;
      this.totalCount = data.totalCount;
      this.tableData = data.items;
    });
  },
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
};
</script>

<style lang="scss" scoped></style>
